Algorithm of hp-adaptation
The automatic hp adaptation algorithm was first described in detail in the books of prof. Leszek Demkowicz, a Polish mathematician working at the University of Texas in Austin. The analysis of the mathematical properties of the hp-adaptation Algorithm was performed by prof. Ivo Babuška, an American of Czech descent, also working at the University of Texas in Austin [1], [2], [3], [4].
- Algorithm for automatic hp adaptation (initial mesh, required accuracy, maximum number of iterations)
- coarse mesh = initial mesh
- loop i = 1 up to the maximum number of iterations
- solve a computational problem on the current coarse mesh (e.g. bitmap projection problem or heat transport problem) by obtaining a solution \( u_{h,p} \)
- coarse mesh = initial mesh
- break each coarse mesh element into 4 elements (for rectangular elements in two dimensions) or 8 elements (for cubic elements in three dimensions) (it is also possible to break triangular elements in two dimensions and tetrahedral elements, prismatic elements and pyramids in three dimensions) and increase the degree of polynomials by one in each direction on each element (which is natural for rectangular and cubic elements, but requires clarification for elements of a different type)
- solve a computational problem on the current fine mesh and obtain a solution \( u_{h/2,p+1} \)
- maximum error \( K_{max}=0 \)
- loop by elements \( K \) coarse mesh
- for each element of the coarse mesh, estimate the relative error (the norm of the difference between the solution on the coarse and fine mesh) \( K_{rel}=\| u_{h,p} - u_{h/2,p+1} \|_K = \int_K \left( u_{h,p}-u_{h/2,p+1} \right)^2 + \left( \frac{\partial u_{h,p}-u_{h/2,p+1}}{\partial x} \right)^2 + \left( \frac{\partial u_{h,p}-u_{h/2,p+1}}{\partial y} \right)^2 \)
- if \( K_{rel}>K_{max} \) then \( K_{max}=K_{rel} \)
- end of loop by elements
- if \( K_{max}> \) required accuracy, then it's over.
- loop by elements \( K \) sparse mesh
- if \( K_{rel}>0.33 K_{max} \) then select the optimal method of adapting the element from the coarse mesh and apply it to the element \( K \) coarse mesh
- end of loop through items
- end of iteration
The hp-adaptation algorithm is illustrated in Fig. 1, Fig. 2, Fig. 3, Fig. 4, Fig. 5.
The convention for drawing computational meshes is as follows. Colors in the drawings Fig. 1, Fig. 3 and Fig. 5 denote the degrees of polynomials spanning over the edges and interior of the elements. One polynomial degree is provided on each edge, while a horizontal degree and a vertical degree are provided on each interior of the element.
For example, in the picture Fig. 1 all polynomials on all edges have degree 2, and all polynomials on the inside of all elements have degree 2 in the vertical and horizontal directions. In the picture Fig. 3 all polynomials on all edges have degree 3, and all polynomials on the inside of all elements have degree 3 in the vertical and horizontal directions. See the drawing Fig. 5. When viewing elements by rows from left to right, in the first row on the first element all polynomials on the edges have degree 2, except for the polynomial on the lower edge of the element which has degree 1. On the first element the polynomials in the interior have degree 2 in the vertical and horizontal directions. On the second element, on the left, top and bottom edges, the polynomials have a degree 2, while on the inside, a degree 3 in the vertical direction and a degree 2 in the horizontal direction. On the third and fourth elements, all polynomials on the edges are of degree 3. Likewise, the polynomials in the interior in the vertical and horizontal directions. In the second row of items, the first item (i.e., the fifth global) has degree 3 polynomials on the left and right edges, and a degree 1 polynomial on the top and bottom edges. Inside, the element has degree 1 polynomials in the horizontal direction and degree 3 polynomials in the vertical direction. The second element in the second line has a polynomial degree 2 in the horizontal direction and a polynomial degree 3 in the vertical direction. On the third and fourth elements, all polynomials on all edges have degree 3, and all polynomials on the inside of all elements have degree 3 in the vertical and horizontal directions. The remaining elements in the third and fourth lines have polynomials symmetrically distributed with the polynomials in the first and second lines on the first and second elements.
What is the optimal method of adapting a single element? Note that in the case of the hp adaptation algorithm, we have many possibilities to modify a single element:
- Leaving the item unchanged
- It is possible to break an element into two new elements vertically
- It is possible to break an element into two new elements in the horizontal direction
- It is possible to break an element into four new elements (two in the horizontal direction and two in the vertical direction).
Moreover, for each broken element it is possible to modify the degree of polynomials inside the element
- Leave element orders unchanged
- It is possible to raise the order inside the element horizontally \( (p_h,p_v)\rightarrow (p_h+1,p_v) \)
- It is possible to raise the order inside the element in a vertical direction \( (p_h,p_v)\rightarrow (p_h,p_v+1) \)
- It is possible to raise the order inside the element horizontally and vertically \( (p_h,p_v)\rightarrow (p_h+1,p_v+1) \)
The orders at the edges of the modified elements are determined on the basis of the minimum rule. In other words, the degree of the polynomial at the edge divided by two adjacent elements is set as a minimum of degrees inside the elements in the appropriate direction.
For a vertical edge surrounded by two elements \( (p^1_h,p^2_v) \) and \( (p^2_h,p^2_v) \) we set the degree \( p=\textrm{min} \{ p^1_v,p^2,v\} \).
For a horizontal edge surrounded by two elements \( (p^1_h,p^2_v) \) and \( (p^2_h,p^2_v) \) we set the degree \( p=\textrm{min} \{ p^1_h,p^2,h\} \).
So we have a lot of possibilities to adapt a single element (estimating on the basis of the possible types of adaptation we have 4 (modifications of the degree of the element without breaking the element) + 4 * 4 (breaking the element into two elements in the horizontal direction and four possibilities of modifying the degree of each element) + 4 * 4 (break an element into two elements vertically and four possibilities to modify the degree of each element) + 4 * 4 * 4 * 4 (break an element into four elements and four possibilities to modify the degree of each element). A total of 4 + 4 * 4 + 4 * 4 + 4 * 4 * 4 * 4 = 292 possibilities.
How is the decision about the type of adaptation of a single element made?
The decision is made in accordance with the following Algorithm.
- Selecting the optimal adaptation strategy for the element \( K \) (a solution on a coarse mesh restricted to an element \( u_{h,p} \), fine mesh solution restricted to the element \( u_{h/2,p+1} \))
- Loop through possible types of element adaptation from 1 to 292 (represented by CODE)
- The fastest error decrease rate = 0
- Optimal adaptation = 0#Copy \( J \), element \( K \), and make the considered adaptation on it
- Calculate the projection \( w \) solutions on a dense mesh \( u_{h/2,p+1} \) on the element being adapted \( J \)
- Calculate by how much the relative error will drop if we make the adaptation represented by CODE, the error decrease rate (CODE) = \( \|u_{h/2,p+1}-u_{h,p}\|_K-\|u_{h/2,p+1}-w\|_K \)
- Calculate how many unknowns (how many base functions) we have to add to implement the adaptation represented by the CODE, adaptation cost (CODE)
- Calculate and remember the error decrease rate (CODE) = error decrease (CODE) / adaptation cost (CODE)
- If the error decrease rate (CODE) is greater than the fastest error decrease rate, remember the greatest error decrease rate value = error rate (CODE), OPTIMAL CODE = CODE
- End of the loop after possible types of adaptation (represented by CODE)
- Perform on element \( K \) the optimal adaptation represented by OPTIMAL CODE
In other words, we choose the type of adaptation for the element that gives the greatest error reduction at the lowest cost. This quantity is represented by the error decrease rate, which increases with the decrease in error but decreases with the cost incurred (with the number of functions added to the element because the cost of the calculation on a given element depends on the number of unknowns which are coefficients of the basis functions). This algorithm is illustrated in Fig. 6.
For the exemplary problem of heat transport in the L-shaped area, it is possible to obtain an adaptive hp mesh that allows solving the problem with the relative error of 0.0001. Such a grid is shown in Fig. 7, Fig. 8, Fig. 9, Fig. 10, Fig. 11, Fig. 12, Fig. 13.
The automatic hp adaptation algorithm is therefore very complicated and difficult to implement. So why is it worth our interest? Consider possible different adaptation algorithms for the exemplary L-shaped heat transport problem, i.e.
- A homogeneous adaptation algorithm where the number of elements is increased evenly over the entire area
- A homogeneous p adaptation algorithm, using a mesh made of 3 elements and increasing uniformly the degree of polynomials inside all elements horizontally and vertically, and the degree of polynomials on all edges
- A homogeneous p adaptation algorithm, using a grid made of 12 elements and increasing uniformly the degree of polynomials inside all elements horizontally and vertically, and the degree of polynomials on all edges
- An automatic p adaptation algorithm, increasing the degree of polynomials in the interiors of selected elements in selected directions, and modifying the degrees on the edges according to the minimum rule
- An automatic adaptation algorithm, breaking selected elements in selected directions
- An automatic hp adaptation algorithm, described in this chapter
If we draw a graph of the convergence of these algorithms in such a way that on the horizontal axis we place the size of the grid understood as the number of basis functions on the entire grid, which corresponds to the number of unknown coefficients of these basis functions, i.e. the size of the matrix of the system of equations to be solved, and on the vertical axis, the relative error calculated in H1 standard between the solution on the coarse mesh and the dense mesh
\( \|u_{h,p}-u_{h/2,p+1}\|_{H^1}=\frac{\int_{\Omega} (u_{h,p}-u_{h/2,p+1})^2+(\frac{\partial (u_{h,p}-u_{h/2,p+1}}{\partial x})^2+(\frac{\partial (u_{h,p}-u_{h/2,p+1}}{\partial x})^2 }{\int_{\Omega} (u_{h/2,p+1})^2+(\frac{\partial (u_{h/2,p+1}}{\partial x})^2+(\frac{\partial (u_{h/2,p+1}}{\partial x})^2 } \)
then it turns out that only the automatic hp adaptation algorithm has the feature of exponential convergence. It is definitely the fastest and can solve a given computational problem with an accuracy that is impossible to achieve by other adaptive algorithms.
then it turns out that only the automatic hp adaptation algorithm has the feature of exponential convergence. It is definitely the fastest and can solve a given computational problem with an accuracy that is impossible to achieve by other adaptive algorithms.
In practice, most engineering problems require accuracy in the range of 5 percent and square polynomials. However, there are computational tasks where high accuracy of the solution is essential. Examples of such computational tasks are, for example, simulations of flows around the wings of aircraft, which require very high accuracy in the boundary layer on the wings of the aircraft, or simulations of the propagation of electromagnetic waves in the geological formation layers to identify oil deposits that require very high accuracy in the vicinity of the receiver antenna.
Bibliography
1. Leszek Demkowicz: Computing with hp-Adaptive Finite Elements, Vol. I. One and Two Dimensional Elliptic and Maxwell Problems, Taylor & Francis, CRC Press 2006, dostęp:18.10.20192. Leszek Demkowicz, Jason Kurtz, David Pardo, Maciej Paszyński, Waldemar Rachowicz, Adam Zdunek A.: Computing with hp-Adaptive Finite Elements, Vol. II.Frontiers: Three Dimensional Elliptic and Maxwell Problems with Applications, Taylor & Francis, CRC Press 2007, dostęp:18.10.2019
3. Ivo Babuška, B. Q. Guo: The hp-version of the finite element method, part 1, Computational mechanics, Maryland Collage Park Campus 1986, dostęp:18.10.2019
4. Ivo Babuška, B. Q. Guo: The hp-version of the finite element method, part 2, Computational mechanics, Maryland Collage Park Campus 1986, dostęp:18.10.2019